package com.mofum.msdom.excel.utils;

public class ReflectUtils {

    public static <T> Class<T> convertToClass(T o) {
        Class clazz = null;

        if (o instanceof Class) {
            clazz = (Class) o;
        } else {
            clazz = o.getClass();
        }
        return clazz;
    }

    public static <T> T newInstance(Class<T> tClass) {
        if (tClass == null) {
            return null;
        }

        try {
            T t = tClass.newInstance();
            return t;
        } catch (InstantiationException e) {
            return null;
        } catch (IllegalAccessException e) {
            return null;
        }
    }
}
